﻿using System;
using System.Reflection;

namespace nRoute.Components.Composition
{
#if (!SILVERLIGHT && !WINRT)
    [Serializable]
#endif
    public class ResolveResourceException 
        : Exception
    {
        private readonly Type _resourceType;

        public ResolveResourceException(string message)
            : this(message, default(Type), default(Exception)) { }

#if (WINRT)
        public ResolveResourceException(string message, TypeInfo resourceType)
            : this(message, resourceType.AsType(), null) { }

        public ResolveResourceException(string message, TypeInfo resourceType, Exception innerException)
            : this(message, resourceType.AsType(), innerException) { }
#endif

        public ResolveResourceException(string message, Type resourceType)
            : this(message, resourceType, null) { }

        public ResolveResourceException(string message, Type resourceType, Exception innerException)
            : base(message, innerException)
        {
            _resourceType = resourceType;
        }

#region Properties

        public Type ResourceType
        {
            get { return _resourceType; }
        }

#endregion

    }
}